package com.mico.example.springboot.mybatis.multi.dao.primary;

import com.mico.example.springboot.mybatis.multi.domain.primary.User;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;

public interface UserMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Thu Mar 07 11:09:00 CST 2019
     */
    @Delete({
        "delete from user",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Thu Mar 07 11:09:00 CST 2019
     */
    @Insert({
        "insert into user (id, username, ",
        "password, email, ",
        "enabled, nickname, userface, ",
        "reg_time)",
        "values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, ",
        "#{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, ",
        "#{enabled,jdbcType=BIT}, #{nickname,jdbcType=VARCHAR}, #{userface,jdbcType=VARCHAR}, ",
        "#{regTime,jdbcType=BINARY})"
    })
    int insert(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Thu Mar 07 11:09:00 CST 2019
     */
    @Select({
        "select",
        "id, username, password, email, enabled, nickname, userface, reg_time",
        "from user",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="username", property="username", jdbcType=JdbcType.VARCHAR),
        @Result(column="password", property="password", jdbcType=JdbcType.VARCHAR),
        @Result(column="email", property="email", jdbcType=JdbcType.VARCHAR),
        @Result(column="enabled", property="enabled", jdbcType=JdbcType.BIT),
        @Result(column="nickname", property="nickname", jdbcType=JdbcType.VARCHAR),
        @Result(column="userface", property="userface", jdbcType=JdbcType.VARCHAR),
        @Result(column="reg_time", property="regTime", jdbcType=JdbcType.BINARY)
    })
    User selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Thu Mar 07 11:09:00 CST 2019
     */
    @Select({
        "select",
        "id, username, password, email, enabled, nickname, userface, reg_time",
        "from user"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="username", property="username", jdbcType=JdbcType.VARCHAR),
        @Result(column="password", property="password", jdbcType=JdbcType.VARCHAR),
        @Result(column="email", property="email", jdbcType=JdbcType.VARCHAR),
        @Result(column="enabled", property="enabled", jdbcType=JdbcType.BIT),
        @Result(column="nickname", property="nickname", jdbcType=JdbcType.VARCHAR),
        @Result(column="userface", property="userface", jdbcType=JdbcType.VARCHAR),
        @Result(column="reg_time", property="regTime", jdbcType=JdbcType.BINARY)
    })
    List<User> selectAll();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Thu Mar 07 11:09:00 CST 2019
     */
    @Update({
        "update user",
        "set username = #{username,jdbcType=VARCHAR},",
          "password = #{password,jdbcType=VARCHAR},",
          "email = #{email,jdbcType=VARCHAR},",
          "enabled = #{enabled,jdbcType=BIT},",
          "nickname = #{nickname,jdbcType=VARCHAR},",
          "userface = #{userface,jdbcType=VARCHAR},",
          "reg_time = #{regTime,jdbcType=BINARY}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(User record);
}